package labuladong.第一章.二叉搜索树;

import leetcode.ListNode;
import leetcode.day_2020_12_14_12_21.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * 相同的二叉树
 */
public class SameTree {
    public boolean isSameTree(TreeNode root1, TreeNode root2) {
        if (root1 == null && root2 == null) {
            return true;
        }
        if (root1 == null || root2 == null) {
            return false;
        }
        if (root1.val != root2.val) {
            return false;
        }
        return isSameTree(root1.left, root2.left) && isSameTree(root1.right, root2.right);
    }
}
